home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 25
/
Cream of the Crop 25.iso
/
os2
/
srefv12i.zip
/
confcolr.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-02-25
|
5KB
|
169 lines
/* modify the colors used in the sre-filter configurator routines */
parse arg ddir, tempfile, reqstrg,list,verb ,uri,user, ,
basedir ,workdir,privset,enmadd,transaction,verbose, ,
servername,host_nickname,homedir
if verb="" then do
say " This SRE-Filter add-on is NOT meant to be run from the command line."
say " It can be invoked by using CONFIGUR.HTM "
exit
end /* Do */
/* chekc for needed_privs superuser */
if wordpos('SUPERUSER',upper(privset))=0 then do
'header add WWW-Authenticate: Basic Realm=<CONFIGURE>' /* challenge */
return sref_response('unauth', "You do not have Superuser privileges ",tempfile,servername)
end
call lineout tempfile, '<!doctype html public "-//IETF//DTD HTML 2.0//EN">'
call lineout tempfile, "<html><head><title>SRE-Filter: Modify Configurator Colors </title>"
call lineout tempfile, "</head><body>"
call lineout tempfile,' <h1>Modify Configurator Colors </h1> <hr>'
do until list="" /* get user input */
parse var list a1 '&' list
parse var a1 a1a '=' a1b
ook='!'||strip(upper(a1a))
stuff.ook=strip(upper(a1b))
end /* do */
/* check custom colors for proper syntax */
checks="!CONFIG !CONFIG0 !CONFIG2 !CONFIG3 "
checks2="!CONFIGC !CONFIG0C !CONFIG2C !CONFIG3C "
mess.1='Configurator Introduction'
mess.2='Simple mode configurator'
mess.3='Intermediate mode configurator'
mess.4='Expert mode configurator'
do mm=1 to 4
ae=strip(word(checks,mm))
is1=stuff.ae
if is1 <>3 then iterate
ill=strip(word(checks2,mm))
af=left(stuff.ill,6)
woo=verify(af,'0123456789ABCDEF')
if woo>0 then do
call lineout tempfile,' <h2>Error in Color Entry </h2> <hr>'
call lineout tempfile,'<b>'af '</b>, your color entry for the ' mess.mm ', is invalid '
call lineout tempfile, ' <bR> The entry must be contain six hex (0123456789ABCDEF) digits '
call lineout tempfile,'</body></html>'
call lineout tempfile
'FILE ERASE TYPE text/html NAME' tempfile
return 'Error in FIXCOLOR'
end
end /* do */
/* now change the colors
DEFAULTS:
INTRO: '10e581'
SIMPLE :'3DEF5F'
INTERMEDIATE: '2DD52F'
ADVANCED: '40C541'
*/
/* FIRST: the configurator intro */
usec='CCCCCC'
if stuff.!config=1 then usec='10e581 '
if stuff.!config=3 then usec=stuff.!configc
useme='<BODY bgcolor="#'||usec||'" > '
call htmlfix 'CONFIGUR.HTM'
call lineout tempfile,'<br> Configurator introduction color: ' usec ' ( <font color="#'||usec||'"> XXXXXXXXXXXXXXXXXXXXXXX </font>'
/* SECOND:the simple mode configurator */
usec='BBBBBB'
usec="3def5f"
if stuff.!config0=3 then usec=stuff.!config0c
useme='<BODY bgcolor="#'||usec||'" > '
call htmlfix 'CONFIG0.HTM'
call cmdfix 'SREFCONF.CMD'
call lineout tempfile,' <br> Simple mode Configurator color: ' usec ' ( <font color="#'||usec||'"> XXXXXXXXXXXXXXXXXXXXXXX </font>'
/* THIRD: the intermediate mode configurator */
usec='DDDDDD'
if stuff.!config2=1 then usec='2dd52f'
if stuff.!config2=3 then usec=stuff.!config2c
useme='<BODY bgcolor="#'||usec||'" > '
call htmlfix 'CONFIG2.HTM'
call cmdfix 'CONFIG2.CMD'
call cmdfix 'VIRTCFG.CMD'
call cmdfix 'ALIASCFG.CMD'
call cmdfix 'ACCESCFG.CMD'
call cmdfix 'USERCFG.CMD'
call cmdfix 'HTACCFG.CMD'
call lineout tempfile,' <br> Intermediate mode Configurator color: ' usec ' ( <font color="#'||usec||'"> XXXXXXXXXXXXXXXXXXXXXXX </font>'
/* FOURTH: the expert mode configurator */
usec='aaaaaa'
if stuff.!config3=1 then usec='40C541'
if stuff.!config3=3 then usec=stuff.!config3c
useme='<BODY bgcolor="#'||usec||'"> '
call htmlfix 'CONFIG3.HTM'
call lineout tempfile,' <br> Expert mode Configurator color: ' usec ' ( <font color="#'||usec||'"> XXXXXXXXXXXXXXXXXXXXXXX </font>'
call lineout tempfile,'</body></html>'
call lineout tempfile
'FILE ERASE TYPE text/html NAME' tempfile
return 'FIXCOLOR completed'
/********** change bgcolor in html file, use global useme */
htmlfix:
parse arg bfile
afile=strip(translate(ddir,'\','/'),'t','\')'\'||bfile
if stream(afile,'c','query exists')='' then do
call lineout tempfile,'<br> Configurator file,'afile', could not be found '
return 0
end /* Do */
foo=charin(afile,1,chars(afile))
parse var foo t1 '<BODY ' . '>' t3
woops=t1||useme||t3
foo=sysfiledelete(afile)
op=charout(afile,woops,1)
return 1
/********* part 3 fixer (uses global usec )*/
cmdfix:
parse arg ado
/* 3rd part 4: the intermediate mode configurator
The files are expected to be in the installation directories.
If not there, we give up */
afile=strip(translate(basedir,'\','/'),'t','\')'\'ado
if stream(afile,'c','query exists')='' then do
call lineout tempfile,' <br> Configurator file, 'afile', could not be found '
return 0
end /* Do */
foo=charin(afile,1,chars(afile))
crlf='0d0a'x
oops=pos('USECOLOR=',upper(foo))
oop2=pos(crlf,foo,oops)
t1=left(foo,oops-1)
t3=substr(foo,oop2+2)
woops=t1||"USECOLOR='"||usec||"'"||crlf||t3
foo=sysfiledelete(afile)
op=charout(afile,woops,1)
return 0